package com.example.musicdemo.util

object StringUtil {
    private const val HOUR = 60 * 60 * 1000
    private const val MIN = 60 * 1000
    private const val SEC = 1000
    fun parseDuration(progress: Int): String {
        val hour = progress / HOUR
        val min = progress % HOUR / MIN
        val sec = progress % MIN / SEC
        var result: String = ""
        result = if (hour == 0) {
            //不住一小时
            String.format("%02d:%02d", min, sec)

        } else {
            String.format("%02d%02d%02d", hour, min, sec)
        }
        return result
    }
}